<?php
define('IN_ECS', true);
require('includes/init.php');
include_once('../comm.php');
extract($_POST);

$result = "failure";
$sql = "SELECT * FROM `".$_table_goods_source."` WHERE img_id=$id ";
$data1 = $GLOBALS['db']->getRow($sql);
$img = '';
$thu = '';
$sou = '';
$tmp = array();

$img = '../'.$data1['img_url'];
$thu = '../'.$data1['thumb_url'];
$sou = '../'.$data1['img_original'];

if(file_exists($img)){
   unlink($img);
}
if(file_exists($thu)){
   unlink($thu);
}
if(file_exists($sou)){
   unlink($sou);
}
//delete from database
$query = "DELETE FROM `".$_table_goods_source."` WHERE img_id=$id ";
$re = $GLOBALS['db']->query($query);
if($re){
	$result = "success";
}else{
	$result = "failure";
}
$d = "<root><info><result>".$result."</result></info></root>";
echo $d;
?>
